Purpose
The fill task fills the elements of an array with a static value. You can specify where to start filling the array and where to end. If not specified, all elements will be filled. This task method overwrites (modifies) the original array.
Potential Use Case
Use this task if you have a dataset and you want to create a new dataset populated with some unique values. Likewise, let's say you have a counter and over the course of time the values in the counter need to be increased incrementally. You could use the fill task to populate the counter with the new values.
Properties
| Incoming | Type | Description |
|---|---|---|
arr |
Array | Required. The array to be filled. |
value |
Any | Required. The value used to fill each element of the array. |
start |
Number | Optional. The index where to start filling the array. If this property is not provided, it will default to zero. |
end |
Number | Optional. The index where to stop filling the array. If this property is not provided, the array length becomes the default. |
| Outgoing | Type | Description |
|---|---|---|
filledArray |
Array | The modified array with the elements filled as specified by the value, start and end properties. |
Examples
Example 1
In this IAP example:
The incoming
arrvariable is set to["1","2","3","4"].The
valuevariable is contained in theNew Variable:Testreference task, which is located in another workflow. The value provided by this reference task is[a,b,c].Parameters for
startandendwere not provided, so the default will be used.With this example, the
filledArrayoutput should read as[a,b,c],[a,b,c],[a,b,c],[a,b,c], which corresponds to the value contained in theNew Variable:Testreference task. This value was used to fill each element of the incoming array.
Example 2
In this IAP example:
The incoming
arrvariable is set to["1","2","3","4"].The
valuevariable isstaticand the provided reference variable given is42.Parameters for
startandendwere not provided, so the default will be used.With this example, the
filledArrayoutput should read as[42,42,42,42], which corresponds to the reference variable that was provided. Essentially, it filled the entire array with the number42by replacing all the initial values that were present in thearrvariable.
Example 3
In this IAP example:
The
arrvalue has been statically set to["Toyota","Mazda","Datsun"].The
valueused to fill the array is statically set to["Nissan"].The values for
startandendhave been statically set to2, which fills the array from position 2 of thearrvalue.With this example, the
filledArrayoutput should be["Toyota","Mazda","Nissan"]. Essentially, from position 2 of the array,Datsunwas replaced byNissan.